<?
    
        $img='';
	if ($_FILES["file"]["error"] > 0)
      {
          echo '{"code":30001,"msg":"文件上传失败，失败代码：'.$_FILES["file"]["error"].'}';
      }
    else
      {
          $_FILES["file"]["name"] = date('YMdHmis').$_FILES["file"]["name"];
          
          if(($_FILES["file"]["size"] / 1024/1024)>=100)
          {
              echo '{"code":30000,"msg":"文件大小超出100MB范围！"}';
          }
          move_uploaded_file($_FILES["file"]["tmp_name"], "./upload/" .$_FILES["file"]["name"]);
          
          if($_SERVER['SERVER_PORT']==80){
              $head = "http://";
          }
          else if($_SERVER['SERVER_PORT']==443){
              $head = "https://";
          }else {
              $head = "http://";
          }
          //$head.$_SERVER['HTTP_HOST'].
          $file_url =  "/shangchuan/upload/" .$_FILES["file"]["name"];
        
          echo '{"code":0,"data":"'.$file_url.'"}';

      }
        
    